#!/bin/bash

# 设置压缩包名称和路径
ZIP_FILE="faceFastApiProject_$(date +"%Y%m%d%H%M%S").zip"

# 设置要排除的文件夹和文件
EXCLUDE_ITEMS=( ".git" ".idea" "__pycache__" "venv" "tests" "*.log" )

# 构建排除参数
EXCLUDE_PARAMS=""
for item in "${EXCLUDE_ITEMS[@]}"; do
    EXCLUDE_PARAMS="$EXCLUDE_PARAMS -x \"$item\""
    EXCLUDE_PARAMS="$EXCLUDE_PARAMS -x \"*$item/*\""
done

# 执行压缩命令
command="zip -r $ZIP_FILE . $EXCLUDE_PARAMS"
eval $command

if [ $? -eq 0 ]; then
    echo "项目已打包到 $ZIP_FILE"
else
    echo "打包失败，请检查错误信息"
fi